import request from '@/utils/system/request'

// 获取数据api
export function getData(data: object) {
  return request({
    url: '/get/road',
	method: 'GET',
    // baseURL: '/mock',
    data
  })
}

export function urolle() {
  return request({
    url: 'get/allRole',
	method: 'GET',
    // baseURL: '/mock',
    // data
  })
}
export function urolleedit(data:object) {
  return request({
    url: '/get/editOperator?userId='+data.UserId,
	method: 'GET',
    // baseURL: '/mock',
    // data
  })
}



// 获取数据api
export function getProduct() {
  return request({
    url: '/get/product',
	method: 'GET',
    // baseURL: '/mock',
    // data
  })
}

// 获取分类数据
export function getCategory(data: object) {
  return request({
    url: '/table/category',
    method: 'post',
    baseURL: '/mock',
    data
  })
}
// 获取分类数据
export function addjiao(data: object) {
  return request({
    url: '/add/operator?operatorAccount='+data.operatorAccount+'&operatorPassword='+data.operatorPassword+'&operatorRole='+data.operatorRole+'&status='+data.status+'&remark='+data.remark,
    method: 'get',
    // baseURL: '/mock',
    // data
  })
}

export function bianji(data: object) {
	console.log(data)
  return request({
    url: '/edit/operator?userId='+data.UserId+'&password='+data.Passwd+'&changePassword='+data.ChangePassword+'&nick='+data.Nick+'&role='+data.RoleUid+'&remark='+data.Remark,
    method: 'get',
    // baseURL: '/mock',
    // data
  })
}


// 获取树组织数据
export function getTree(data: object) {
  return request({
    url: '/table/tree',
    method: 'post',
    baseURL: '/mock',
    data
  })
}

// 新增
export function add(data: object) {
  return request({
    url: '/add/road',
    method: 'post',
    // baseURL: '/mock',
    data
  })
}
// 新增
export function addjiaoshe(data: object) {
  return request({
    url: '/add/role?roleName=&roleRemark='+data.Remark+'&roleNameAdd='+data.RoleName,
    method: 'post',
    // baseURL: '/mock',
    // data
  })
}
// 编辑
export function update(data: object) {
	var reg = /[\u4e00-\u9fa5]/;
	 if (reg.test(data.ProductName)){
		  data.ProductName=data.ProductUid
	 }
	// data.ProductUid=data.ProductName
	 // alert(data.namev)
	 
  return request({
    url: '/add/editroad',
    method: 'post',
    // baseURL: '/mock',
    data
  })
}
// 编辑
export function updateone(data: object) {
  return request({
    url: '/get/oneRoad',
    method: 'post',
    // baseURL: '/mock',
    data
  })
}

export function uid() {
  return request({
    url: '/get/zhuzhuang?merchantUid=&agentUid=&supplierUid=&payType=&startTime=&endTime=',
    method: 'get',
    // baseURL: '/mock',
    // data
  })
}
// 删除
export function del(data: object) {
  return request({
    url: '/delete/road',
    method: 'post',
    // baseURL: '/mock',
    data
  })
}
// 删除
export function djapi(data: object) {
  return request({
    url: 'update/roadStatus?roadUid='+data.roadUid,
    method: 'post',
    // baseURL: '/mock',
    data
  })
}
export function jhapi(data: object) {
  return request({
    url: 'update/roadStatus?roadUid='+data.roadUid,
    method: 'post',
    // baseURL: '/mock',
    data
  })
}
// 新增通道
export function addtong(data: object) {
  return request({
    url: 'add/roadPool?roadPoolName='+data.RoadName+'&roadPoolCode='+data.RoadRemark,
    method: 'GET',
    // baseURL: '/mock',
    data
  })
}


